package cn.codehaus.core.common.action;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.ServletActionContext;

import cn.codehaus.core.common.server.ApplicationContextUtil;

import com.opensymphony.xwork2.ActionSupport;

/**
 * DispatchAction基类
 * @author maomao
 *
 */
public class BaseAction extends ActionSupport
{
	private static Log log = LogFactory.getLog(BaseAction.class);
	
	/**
	 * 从服务容器中获取服务组件
	 * 
	 * @param pBeanName
	 *            :BeanID
	 * @return Object
	 */
	protected Object getService(String pBeanId) {
		Object springBean = ApplicationContextUtil.getBean(pBeanId);
		return springBean;
	}
	/**
	 * 获取Request对象
	 * @return
	 */
	protected HttpServletRequest getRequest(){
		return ServletActionContext.getRequest();
	}
	
}
